<template>
  <div class="shouRuShenheSJTJ el-card is-always-shadow el-card__body">
    <el-dialog
      title="收入审核数据提交"
      :visible.sync="dialogVisible"
      @close="closed"
      width="950px">
    <avue-crud
      class="submit"
      ref="crud"
      :option="option"
      :table-loading="listLoading"
      :data="tableData"
      :page.sync="page"
      :search.sync="searchForm"
      @search-change="handleFilter"
      @selection-change="selectionChange"
      @on-load="search">
      <template slot-scope="scope" slot="search">
      <div style="margin-left: -80px;display: inline-flex;">
        <el-form-item label="开始时间" >
          <el-date-picker
            v-model="searchForm.beginTime" >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="结束时间" style="margin-left: 30px">
          <el-date-picker
            v-model="searchForm.endTime" :pickerOptions="{
                    disabledDate(time) {
                    return time.getTime() > Date.now();
            }}">
          </el-date-picker>

        </el-form-item>
      </div>
      </template>
      <template slot-scope="scope" slot="timeSearch"><div style="width: 10px"></div></template>
      <template slot="searchMenu" slot-scope="{row,size}">
        <el-button :size="size" @click="()=>{setSearchFiledsEmpty(row);setSearchFiledsEmpty(searchForm)}" icon="el-icon-delete">清空</el-button>
      </template>
    </avue-crud>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="submitSetDate">确 认</el-button>
      </div>
    </el-dialog>
  </div>
</template>


<script>
    import {getForm, postForm} from '@/api/gen/gen'
    import {
      getgetStationCodes,
      getLineCodes, getLineName, getStationName,setSearchFiledsEmpty
    } from "../../../api/subwayRat/commonCheck";
    import {getSwAuDataSubmitList} from "../../../api/subwayRat/shouRuShenheSJTJ";
    export default {
      components:{
      },
      data() {
            return {
              listLoading: true,
              fileTemp:{},
              searchForm:{},
              tableData:[],
              dialogVisible:false,
              page: {
                total: 0, // 总页数
                currentPage: 1, // 当前页数
                pageSize: 20, // 每页显示多少条,
                isAsc: false// 是否倒序
              },
              multipleSelectionRows:[],
              multipleSelectionKeys:[],
              lineCodes:[],
              stationCodes:[],
              option:{
                emptyBtn:false,
                editBtn:false,
                delBtn:false,
                addBtn:false,
                border: true,
                index:true,
                header:false,
                indexLabel:'序号',
                page:true,
                search:true,
                align:'center',
                menu:false,
                menuWidth:150,
                menuAlign:'center',
                selection: true,
                reserveSelection:true,
                column:[
                  {prop:"lineCode", label:"线路"},
                  {prop:"stationCode", label:"车站"},
                  {prop:"se" ,label:"数据开始时间"},
                  {prop:"submitState", label:"提交人"},
                  {prop:"time" ,label:"",hide:true,search:true,searchslot:true},
                  ]
              },
            }
        },
        created() {

        },
        methods: {
          setSearchFiledsEmpty,
          submitSetDate(){

          },
          show(rows){
            this.dialogVisible=true;
            this.tableData=rows;
          },
          search(){
            Object.assign(this.searchForm,this.page);
            getSwAuDataSubmitList(this.searchForm).then((res)=>{
              this.tableData=res.data.data;
              this.listLoading = false;
              this.page.total=res.data.total;
            });
          },

          handleSelectionChange(val,a){
            this.multipleSelectionRows=val;
            this.multipleSelectionKeys=[];
            for(let i=0;i<this.multipleSelectionRows.length;i++){
              this.multipleSelectionKeys.push(this.multipleSelectionRows[i].id);
            }
          },
          initLine(){
            getLineCodes().then(res=>{ //获取线路
              this.lineCodes=res;
            });
          },
          changeLine(v){
            getgetStationCodes(v).then(res=>{
              this.stationCodes=res;
            })
          },
          selectionChange(list){
            this.multipleSelectionRows=list;
            this.multipleSelectionKeys=[];
            for(let i=0;i<list.length;i++){
              this.multipleSelectionKeys.push(list[i].id);
            }
          },
          handleFilter(params, done) {
            Object.assign(this.searchForm,params);
            this.search()
            done()
          },
          closed(){
            this.$parent.isShowDia=false;
            this.dialogVisible = false;
          }
        },
      mounted() {
        this.search();
        this.initLine();
      }
    }
</script>
<style lang="scss">
.shouRuShenheSJTJ .submit{
}
</style>
